package com.devilvan.betrice.aiqicha.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
* @author Evad.Wu
* @Description 爱企查-行政许可信息 映射
* @date 2022-09-24
*/
@Setter
@Getter
@ToString(exclude = "aiqichaHeaderPo")
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "AIQICHA_LICENSE")

@Entity
@Table(name = "AIQICHA_LICENSE")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "爱企查-行政许可信息 映射")
public class AiqichaLicensePo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = -7722783517679577705L;
    @Schema(description = "企业系统ID")
    @TableField(value = "PID")
    @Column(name = "PID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '企业系统ID'")
    private Long pid;
    @Schema(description = "行政许可证号")
    @TableField(value = "LICENSE_NUMBER")
    @Column(name = "LICENSE_NUMBER", columnDefinition = "VARCHAR(64) COMMENT '行政许可证号'")
    private String licenseNumber;
    @Schema(description = "许可名称")
    @TableField(value = "LICENSE_NAME")
    @Column(name = "LICENSE_NAME", columnDefinition = "VARCHAR(64) COMMENT '许可名称'")
    private String licenseName;
    @Schema(description = "许可内容")
    @TableField(value = "LICENSE_CONTENT")
    @Column(name = "LICENSE_CONTENT", columnDefinition = "TEXT(65,535) COMMENT '许可内容'")
    private String licenseContent;
    @Schema(description = "有效期值自")
    @TableField(value = "VALIDITY_FROM")
    @Column(name = "VALIDITY_FROM", columnDefinition = "DATETIME COMMENT '有效期值自'")
    private Date validityFrom;
    @Schema(description = "有效期至")
    @TableField(value = "VALIDITY_TO")
    @Column(name = "VALIDITY_TO", columnDefinition = "DATETIME COMMENT '有效期至'")
    private Date validityTo;
    @Schema(description = "许可机关")
    @TableField(value = "ISSUE_AUTHORITY")
    @Column(name = "ISSUE_AUTHORITY", columnDefinition = "VARCHAR(128) COMMENT '许可机关'")
    private String issueAuthority;

    @TableField(exist = false)
    @ManyToOne(targetEntity = AiqichaHeaderPo.class,cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    @JoinColumn(name = "PID",referencedColumnName = "PID",insertable = false,updatable = false)
    private AiqichaHeaderPo aiqichaHeaderPo;
}
